#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#       untitled.py
#       
#       Copyright 2012 Rui Pereira <rpereira@Error>
#       
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 2 of the License, or
#       (at your option) any later version.
#       
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#       
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.
#       
#       

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# codigo inicial inspirado pelo professor e pelo colega Manuel Coelho 



import random

def preencher_tabela():
    T = [0 for x in range(0,1000)]
    ct = 0
    tab_contagem = [0 for x in range(0,10)]

    while ct < 1000:
        x = random.randint(0,9)
        if tab_contagem[x] > 99:
            continue
        tab_contagem[x] += 1
        T[ct] = x
        ct += 1
        pass
    return T

def contagem(T):
    tab_contagem = [0 for x in range(0,10)]
    for x in T:
        tab_contagem[x] += 1
        pass
    for x in tab_contagem:
        print x
        pass
    pass

T = preencher_tabela()      
    
print len(T)
print T
contagem(T)
